//package com.imedway.ihe.dtz.xds.conf;
//
//import java.util.List;
//
//import org.apache.cxf.binding.soap.SoapMessage;
//import org.apache.cxf.headers.Header;
//import org.apache.cxf.interceptor.Fault;
//import org.apache.cxf.message.Message;
//import org.apache.cxf.phase.AbstractPhaseInterceptor;
//import org.apache.cxf.phase.Phase;
//import org.springframework.context.annotation.Configuration;
//import org.w3c.dom.Element;
//
//import lombok.extern.slf4j.Slf4j;
//
//@Slf4j
//@Configuration
//public class WebServiceInterceptor extends AbstractPhaseInterceptor<SoapMessage> {
// 
//	public WebServiceInterceptor() {
//		super(Phase.PRE_INVOKE);
//	}
//   
//    
//	public void handleMessage(SoapMessage soapMsg) throws Fault {
// 
//		List<Header> headers = soapMsg.getHeaders();// 根据soap消息获取头部
//		String requestURL = (String) soapMsg.get(Message.REQUEST_URL);
//		log.info(requestURL);
//		if(requestURL!=null&&requestURL.contains("XDS")) {
//			log.info("不拦截");
//		}else {
//			if (headers == null || headers.size() == 0) {
//				throw new Fault(new IllegalArgumentException("拒绝访问，原因：没有header！"));
//			}
//			for (Header header : headers) {
//				Element ele = (Element) header.getObject();
////				String  entryStr = "";
////				if(ele.getNodeName().contains("MessageID")) {
////					entryStr = ele.getTextContent();
////				}
//////				NodeList nodeList = ele.getElementsByTagName("MessageID");
//////				if (nodeList == null || nodeList.getLength() == 0) {
//////					throw new Fault(new IllegalArgumentException("拒绝访问，原因：通行信息为空！"));
//////				}
//////				String entryStr = nodeList.item(0).getTextContent();
////				if (StringUtils.isNotBlank(entryStr)) {
//////					boolean entryFlag = CommonUtil.validRequestClient(entryStr);
//////					if (!entryFlag) {
//////						throw new Fault(new IllegalArgumentException(
//////								"拒绝访问，原因：通行信息验证未通过！"));
//////					}
////				} else {
////					throw new Fault(new IllegalArgumentException("拒绝访问，原因：通行信息为空！"));
////				}
//			}
//	 
//		}
//		
//	}
// 
//}
